#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableHeroSoulCardDao:DaoBase<TableHeroSoulCard>
    {
        public override string GetFileName()
        {
            return "TableHeroSoulCard.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableHeroSoulCard>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TableHeroSoulCard model)
        {
            if (!cacheOneIndex.ContainsKey(model.propType.ToString()))
            {
                cacheOneIndex[model.propType.ToString()] = new List<TableHeroSoulCard>();
            }
            cacheOneIndex[model.propType.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TableHeroSoulCard model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.Id)) UnityEngine.Debug.LogError("数据表id重复:TableHeroSoulCard->id: " + model.Id);
            #endif
            cachePrimaryInt[model.Id] = model;
        }
        protected override TableHeroSoulCard ParseRowData(string[] rowData)
        {
            TableHeroSoulCard data = new TableHeroSoulCard();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.Id = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.propType = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.quality = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.extrafightPower = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.icon = rowData[4];
            }
            return data;
        }
    }
}
